/*
 * Filename    : State_Menu_Main.java
 * Projectname : Sound Of Indonesia
 * Date        : Nov 1, 2012 , 1:10:01 PM 
 * 
 * PratamaNurWijaya
 */

package id.pratama.soundofindonesia.state;

import id.pratama.soundofindonesia.Utils;

import org.andengine.entity.scene.ITouchArea;
import org.andengine.input.touch.TouchEvent;

import android.view.KeyEvent;

public class State_Menu_Main extends State_Menu_Daerah
{

	private final byte	START	= 0;
	private final byte	OPTIONS	= 1;
	private final byte	CREDIT	= 2;

	protected void createMenuMain()
	{
		grafik.attachMainBg();
		teks.attachTeksMenuMain();
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event)
	{
		if (State_Menu_Current == STATE_MENU_MAIN)
		{
			if (keyCode == KeyEvent.KEYCODE_BACK)
			{
				finish();
			}
		}
		return super.onKeyDown(keyCode, event);
	}

	@Override
	public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX,
			float pTouchAreaLocalY)
	{
		if (State_Menu_Current == STATE_MENU_MAIN)
		{
			if (pTouchArea.equals(teks.txt_Menu_Main[START]))
			{
				Utils.TRACE("Start");
				grafik.detachMenuMain();
				teks.detachTextMainMenu();
				switchState(STATE_MENU_DAERAH);
				
			} else if (pTouchArea.equals(teks.txt_Menu_Main[OPTIONS]))
			{
				Utils.TRACE("Options");
			} else if (pTouchArea.equals(teks.txt_Menu_Main[CREDIT]))
			{
				Utils.TRACE("Credits");
			}
		}
		return super.onAreaTouched(pSceneTouchEvent, pTouchArea, pTouchAreaLocalX, pTouchAreaLocalY);
	}

}
